import java.io.File;
import java.io.InputStream;
import java.util.Date;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.*;

//import com.mysql.jdbc.Connection;

public class DOMParser {
	//DBConnection dbconn = new DBConnection();
	String url;
	String adresse;
	String latti;
	String longi;
	int counter = 0;
	boolean myboolean;

	DOMParser(String adr) {
		this.adresse = adr;
	}
	
	public String[] parsePage() {
// &&counter < 150000boolean iscontinue = true;
			url = "http://maps.googleapis.com/maps/api/geocode/xml?address="+adresse+"&sensor=true";
			// document holen
			HttpConnection connection = new HttpConnection(url);
			Document mydoc = connection.returnXML();
			// while schleife anpassen

			NodeList nodelist_lat = mydoc.getElementsByTagName("lat");
			NodeList nodelist_lng = mydoc.getElementsByTagName("lng");

			Element myel_lat = (Element) nodelist_lat.item(0);
			Element myel_lng = (Element) nodelist_lng.item(0);
			latti = myel_lat.getChildNodes().item(0).getTextContent();
			longi = myel_lng.getChildNodes().item(0).getTextContent();
			String[] koords = {latti, longi};
			return koords;
			// Element el = mydoc.getElementById("allpages");
	}

}
